<div class="container">
    
    <div class="form-horizontal">
        
        <div class="control-group">
            <label class="control-label">Pedido</label>
            <div class="controls">
                <input type="text" class="span2 input-block-level" value="<?=$pedido['idPedidos']?>" disabled> 
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Cliente</label>
            <div class="controls">
                <input type="text" class="span6 input-block-level" value="<?=$cliente['nombre']?>" disabled>
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Orden de Compra</label>
            <div class="controls">
                <input type="text" class="span4 input-block-level" value="<?=$pedido['ordenDeCompra']?>" disabled>
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Moneda</label>
            <div class="controls">
                <input type="text" class="span2 input-block-level" value="<?=$moneda['moneda']?>" disabled>
            </div>
        </div>
        
    </div>
    
    <?php echo validation_errors("<div class='alert alert-danger'>", "</div>"); ?>
    
    <form class="form-inline" method="post">
        <div class="row">
            <input name="cantidad" id="cantidad" type="text" class="span2 input-block-level" placeholder="Cantidad">
            <select name="articulo" class="span4 chosen">
                <?php foreach($articulos as $articulo) { ?>
                <option value="<?=$articulo['idArticulo']?>"><?=$articulo['producto']['nombre'].' '.$articulo['codigo'].' '.$articulo['marca']['nombre']?></option> 
                <?php } ?>
            </select>
            <input name="precio" type="text" class="span2 input-block-level" placeholder="Precio">
            <div id="datepicker" class="input-append">
                <input name="fecha" class="input-block-level" data-format="yyyy-MM-dd" type="text">
                <span class="add-on">
                    <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
                </span>
            </div>
            
        </div>
        <br>
        <div class="text-center"><button type="submit" class="btn btn-primary">Agregar</button></div>
    </form>
    
    <hr>
    
    <div class="text-center">
        <a href="/consultas/">
            <button type="submit" class="btn btn-primary">Finalizar</button>
        </a>
    </div>
    <br>
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                <th>Cantidad</th>
                <th>Artículo</th>
                <th>Precio</th>
                <th>Fecha</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach($items as $item) { ?>
            <tr>
                <td><?=$item['cantidad']?></td>
                <td><?=$item['articulo']['codigo']?></td>
                <td><?=number_format($item['precio'], 2)?></td>
                <td><?= strftime('%d/%m/%Y', strtotime($item['fechaEntrega'])) ?></td>
            </tr>
            <?php } ?>
        </tbody>
    </table>
    
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $("#cantidad").focus();
        $(".chosen").chosen();
        $("#datepicker").datetimepicker({
            pickTime: false
        });
    })
</script>